#ifndef _RECOPROXY_API_H_
#define _RECOPROXY_API_H_
#include<stdio.h>
#include<stdlib.h>
//render list enum
enum recoVADRenderID
{
	RECO_VAD_UNKNOWN,
	RECO_WEBRTC//google webrtc
};
enum recoASRRenderID
{
	RECO_ASR_UNKNOWN,
	RECO_ASR_IFLYTEK//讯飞, it is default
};
enum recoCbType
{
	RECO_CB_DATA=0,
	RECO_CB_CMDCLOSE=1 //command for close
};
/*vad option sturct
 * _dVadPauseTime            --vad Pause time
 * _dVadDurationTime         --vad duriation time
 * _dVadEnergeMax            --max energe of vad 
 * _dVadEnergeMin            --min energe of vad 
 * _iVadPauseTimeGiven       --if vadPauseTime is given, then it is 1, otherwise it is 0.
 * _iVadDurationTimeGiven    --if vadDurationTime is given, then it is 1, otherwise it is 0.
 * _iVadEnergeMaxGiven       --if vadEnergeMax is given, then it is 1, otherwise it is 0.
 * _iVadEnergeMinGiven       --if vadEnergeMin is given, then it is 1, otherwise it is 0.
 */


typedef struct vadOptions 
{
	char   _vadFilePath[512]; //vad file path
	int    _iVadPauseTime;  //pauseTime
	int    _iVadDurationTime;//DuriationTime
	int    _iVadEnergeMax; 
	int    _iVadEnergeMin;  //Min engine
	int    _iSampleRatio; //samping ratio
	int    _iEnableDebug; //enable debug
	int    _iVadFilePathLen; //vad file path length
	int    _iVadRenderId; //vad render ID

	int       _iVadPauseTimeGiven;
	int       _iVadDurationTimeGiven;

	int       _iVadEnergeMaxGiven;
	int       _iVadEnergeMinGiven;
	int       _iSampleRatioGiven;
	int       _iVadFilePathGiven;
	int       _iVadRenderGiven;
}vadOptions;
/*asr option struct
 * _pLang  --language of asr
 * */

typedef struct asrOptions
{
	char _pLang[128]; //zh_cn 中文, en_us 英文
	int  _iStreamReturn; //流式返回是否开启
	int  _iAsrRenderId;
}asrOptions;


typedef struct asrRes
{
	char  _sid[128];    //sid
	char  _file[256];   //file path
	char* _pRes;        //res 
	int   _iResLen;     //res
	int   _iIndex;      //Index
	int   _iPos;        //Position
	int   _iBeginTime;  //BeginTime
	int   _iEndTime;    //EndTime
}asrRes;
typedef struct asrMsg
{
	int _iCommand;//0.1 0=data. 1=close command
	asrRes* _pAsrRes;
}asrMsg;

/*getResCb --callback function
* pCbObj --callback object
* pRes --asr result
* iLen --asr result len
* iIsFinal --fianl result or not
*/
typedef int (*getResCb) (void* pCbObj, asrMsg* pMsg, int iIsFinal);
#ifdef __cplusplus
extern "C" {
#endif
	/*
	 * pCreateRecoProxy create interface
	 * pUuid uuid is a must which is a unique key 
	 * pCbObj     --callback object
	 * iRenderId  --renderId like RECO_LENOVO etc
	 * pVadOptions --options for vad
	 * pVsrOption --options for asr
	 * pCbfunc    --callback function pointer
	 * return recoProxy pointer
	 * */
	void* pCreateRecoProxy(const char* pUuid,int iUuidLen,void* pCbObj,  vadOptions* pVadOptions, asrOptions* pAsrOptions, getResCb pCbfunc);
	/**
	 * pFeedDataToRecoProxy feedData interface
	 * pRecoProxy --recoProxy pointer
	 * pData     --PCM data
	 * iLen      --PCM data length
	 */
	void pFeedDataToRecoProxy(void* pRecoProxy,char* pData, int iLen);
	/*pCloseRecoProxy release function
	 * pRecoProxy  --recoProxy pointer
	 * */
	void pCloseRecoProxy(void* pRecoPproxy);

#ifdef __cplusplus
}
#endif
#endif
